# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=bolt
pkgver=0.9.8
pkgrel=2
pkgdesc="Thunderbolt 3 device manager"
url="https://gitlab.freedesktop.org/bolt/bolt"
arch="all"
license="LGPL-2.1-or-later"
makedepends="
	asciidoc
	bash
	eudev-dev
	glib-dev
	meson
	polkit-dev
	"
checkdepends="
	dbus
	py3-gobject3
	"
subpackages="$pkgname-doc"
source="https://gitlab.freedesktop.org/bolt/bolt/-/archive/$pkgver/bolt-$pkgver.tar.gz
	gcc14-incompatible-pointer-type.patch
	"

# tests hit a udf instruction, due to some test_notify_teardown pointer free
# being undefined. using a different allocator fixes it, so musl is being
# strict about the UB tests here, but the issue is not from the code itself
options="$options !check"

build() {
	abuild-meson \
		-Db_lto=true \
		-Dman=true \
		-Dsystemd=false \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
ca3f1859b01f1370f508696192050231f5ced9a3c10eaa8d508b130f9202cc9161eb50e6884a8818c284f23bdc9d7cb6662442cd04d9d7eb8aeca1a1c0d5c060  bolt-0.9.8.tar.gz
cc5e958d89972d6a5c42bd3d65d47780a2b7b97c8b77e24075c5f75db57ea7207cc8e8159ffb94fedc69902b2ffe7c674bd9da9c5d9e9f324d364262581187b7  gcc14-incompatible-pointer-type.patch
"
